//
//  goodsbtn.m
//  xiaoyiNew
//
//  Created by 讯一 on 16/12/28.
//  Copyright © 2016年 讯一. All rights reserved.
//

#import "goodsbtn.h"

@implementation goodsbtn

-(id)initWithFrame2:(CGRect)frame title:(NSString *)title imagestr:(NSString *)imagestr price:(NSString*)price{
    self = [super initWithFrame:frame];
    if(self) {
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width/2-22, 10, 44, 44)];
        imageView.image = [UIImage imageNamed:imagestr];
        [self addSubview:imageView];
        
        
        UILabel *titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 15+44, frame.size.width, 20)];
        titlelab.text = title;
        titlelab.textAlignment = NSTextAlignmentCenter;
        titlelab.font = [UIFont systemFontOfSize:12];
        titlelab.numberOfLines = 0 ;
        [self addSubview:titlelab];
        
        UILabel *pricel = [[UILabel alloc]initWithFrame:CGRectMake(0, 15+44+22, frame.size.width, 19)];
        pricel.text = price;
        pricel.textAlignment = NSTextAlignmentCenter;
        pricel.font = [UIFont systemFontOfSize:11];
        pricel.textColor = [UIColor redColor];
        [self addSubview:pricel];
        
    }
    return self;
}


-(id)initWithFrame:(CGRect)frame title:(NSString *)title imagestr:(NSString *)imagestr price:(NSString*)price{
    self = [super initWithFrame:frame];
    if(self) {
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width/2-22, 15, 44, 44)];
        imageView.image = [UIImage imageNamed:imagestr];
        [self addSubview:imageView];
        
        
        UILabel *titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 15+44, frame.size.width, 20)];
        titlelab.text = title;
        titlelab.textAlignment = NSTextAlignmentCenter;
        titlelab.font = [UIFont systemFontOfSize:12];
        titlelab.numberOfLines = 0 ;
        [self addSubview:titlelab];
        
        UILabel *pricel = [[UILabel alloc]initWithFrame:CGRectMake(0, 15+44+22, frame.size.width, 19)];
        pricel.text = price;
        pricel.textAlignment = NSTextAlignmentCenter;
        pricel.font = [UIFont systemFontOfSize:11];
        pricel.textColor = [UIColor redColor];
        [self addSubview:pricel];
    }
    
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
